#pragma once
#pragma once
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <fstream>
#include <vector>

using namespace std;
class Result
{
private:
	string testName;
	char grade;
public:

#pragma region Constructor/Destructor
	Result()
	{
		testName = "";
		grade = ' ';
	}

	Result(string testName, char grade)
	{
		this->grade = grade;
		this->testName = testName;
	}

	~Result(){}
#pragma endregion

	void read()
	{
		string s;
		cout << "Test name: ";
		getline(cin, testName);
		cout << "Grade: ";
		getline(cin, s);
		istringstream iss(s);
		iss >> grade;
	}

	//Data format object=(*data*)
	//Student=(Kalle,Anka,1991)
	//Course=(courseName,Year)
	//Result=(testName,grade)
	//Result=(testName,grade)
	friend ostream& operator<<(ostream &out, const Result &r)
	{
		out << "(";
		out << r.testName << ",";
		out << r.grade << ")";
		return out;
	}

	friend istream& operator>>(istream &in, Result &r)
	{
		string str;
		getline(in, str, '(');
		getline(in, r.testName, ',');
		getline(in, str, ')');
		istringstream iss(str);
		iss >> r.grade;
		return in;
	}

	string getName(){ return testName; }
};

